#include "ColorBlock.h"


ColorBlock::ColorBlock(void)
	:_wayBlock(NULL), _color(WHITE)
{
}


ColorBlock::~ColorBlock(void)
{
}

void ColorBlock::setWayBlock(WayBlock* wb)
{
	if( _wayBlock )
		delete _wayBlock;
	_wayBlock = wb;
}

/*virtual*/ 
void ColorBlock::crashSufferBlock(Block* b)
{
	if( _wayBlock )
	{
		_wayBlock->crashSufferBlock(b);
		this->setSpeed(_wayBlock->getSpeed());
	}
	else
	{
		Block::crashSufferBlock(b);
	}
}


//---------------------------------------------------------------------

RedBlock::RedBlock()
{
	_color = RED;
	this->setTextureName(".//image/colorredblock.png");
}

GreenBlock::GreenBlock()
{
	_color = GREEN;
	this->setTextureName(".//image/colorgreenblock.png");
}

BlueBlock::BlueBlock()
{
	_color = BLUE;
	this->setTextureName(".//image/colorblueblock.png");
}

YellowBlock::YellowBlock()
{
	_color = YELLOW;
	this->setTextureName(".//image/coloryellowblock.png");
}
